home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 August: Tool Chest / Dev.CD Aug 95 TC / Dev.CD Aug 95 TC.toast / Tool Chest / Interfaces / UniversalInterfaces 2.0 / PInterfaces / MoviesFormat.p < prev    next >
Encoding:
Text File  |  1995-04-18  |  13.7 KB  |  508 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        MoviesFormat.p
  3.  
  4.      Contains:    QuickTime Interfaces.
  5.  
  6.      Version:    Technology:    QuickTime 2.0
  7.                  Package:    Universal Interfaces 2.0 in “MPW Latest” on ETO #17
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. }
  19.  
  20. {$IFC UNDEFINED UsingIncludes}
  21. {$SETC UsingIncludes := 0}
  22. {$ENDC}
  23.  
  24. {$IFC NOT UsingIncludes}
  25.  UNIT MoviesFormat;
  26.  INTERFACE
  27. {$ENDC}
  28.  
  29. {$IFC UNDEFINED __MOVIESFORMAT__}
  30. {$SETC __MOVIESFORMAT__ := 1}
  31.  
  32. {$I+}
  33. {$SETC MoviesFormatIncludes := UsingIncludes}
  34. {$SETC UsingIncludes := 1}
  35.  
  36.  
  37. {$IFC UNDEFINED __TYPES__}
  38. {$I Types.p}
  39. {$ENDC}
  40. {    ConditionalMacros.p                                            }
  41.  
  42. {$IFC UNDEFINED __WINDOWS__}
  43. {$I Windows.p}
  44. {$ENDC}
  45. {    Memory.p                                                    }
  46. {        MixedMode.p                                                }
  47. {    Quickdraw.p                                                    }
  48. {        QuickdrawText.p                                            }
  49. {    Events.p                                                    }
  50. {        OSUtils.p                                                }
  51. {    Controls.p                                                    }
  52. {        Menus.p                                                    }
  53.  
  54. {$IFC UNDEFINED __IMAGECOMPRESSION__}
  55. {$I ImageCompression.p}
  56. {$ENDC}
  57. {    QDOffscreen.p                                                }
  58. {        Errors.p                                                }
  59. {    Components.p                                                }
  60. {    StandardFile.p                                                }
  61. {        Dialogs.p                                                }
  62. {            TextEdit.p                                            }
  63. {        Files.p                                                    }
  64.  
  65. {$IFC UNDEFINED __MOVIES__}
  66. {$I Movies.p}
  67. {$ENDC}
  68. {    Aliases.p                                                    }
  69. {        AppleTalk.p                                                }
  70.  
  71. {$PUSH}
  72. {$ALIGN MAC68K}
  73. {$LibExport+}
  74.  
  75. CONST
  76.     kMovieVersion                = 0;                            { version number of the format here described }
  77.  
  78.  
  79. TYPE
  80.     MoviesUserData = RECORD
  81.         size:                    LONGINT;                                { size of this user data }
  82.         udType:                    LONGINT;                                { type of user data }
  83.         data:                    PACKED ARRAY [0..0] OF CHAR;            { the user data }
  84.     END;
  85.  
  86.     UserDataAtom = RECORD
  87.         size:                    LONGINT;
  88.         atomType:                LONGINT;
  89.         userData:                ARRAY [0..0] OF MoviesUserData;
  90.     END;
  91.  
  92. { MoviesDataDescription tells us where the data for the movie or track lives.
  93.    The data can follow the directory, be in the datafork of the same file as the directory resource,
  94.    be in the resource fork of the same file as the directory resource, be in another file in the
  95.    data fork or resource fork, or require a specific bottleneck to fetch the data. }
  96. {***************************************
  97. *
  98. *   MediaDirectory information -
  99. *        The MediaDirectory is tightly coupled to the data.
  100. *
  101. ***************************************}
  102.     SampleDescriptionAtom = RECORD
  103.         size:                    LONGINT;
  104.         atomType:                LONGINT;                                { = 'stsd' }
  105.         flags:                    LONGINT;                                { 1 byte of version / 3 bytes of flags }
  106.         numEntries:                LONGINT;
  107.         sampleDescTable:        ARRAY [0..0] OF SampleDescription;
  108.     END;
  109.  
  110. { TimeToSampleNum maps physical sample time to physical sample number. }
  111.     TimeToSampleNum = RECORD
  112.         sampleCount:            LONGINT;
  113.         sampleDuration:            TimeValue;
  114.     END;
  115.  
  116.     TimeToSampleNumAtom = RECORD
  117.         size:                    LONGINT;
  118.         atomType:                LONGINT;                                { = 'stts' }
  119.         flags:                    LONGINT;                                { 1 byte of version / 3 bytes of flags }
  120.         numEntries:                LONGINT;
  121.         timeToSampleNumTable:    ARRAY [0..0] OF TimeToSampleNum;
  122.     END;
  123.  
  124. { SyncSamples is a list of the physical samples which are self contained. }
  125.     SyncSampleAtom = RECORD
  126.         size:                    LONGINT;
  127.         atomType:                LONGINT;                                { = 'stss' }
  128.         flags:                    LONGINT;                                { 1 byte of version / 3 bytes of flags }
  129.         numEntries:                LONGINT;
  130.         syncSampleTable:        ARRAY [0..0] OF LONGINT;
  131.     END;
  132.  
  133. { SampleToChunk maps physical sample number to chunk number. }
  134. { same as SampleToChunk, but redundant first sample is removed }
  135.     SampleToChunk = RECORD
  136.         firstChunk:                LONGINT;
  137.         samplesPerChunk:        LONGINT;
  138.         sampleDescriptionID:    LONGINT;
  139.     END;
  140.  
  141.     SampleToChunkAtom = RECORD
  142.         size:                    LONGINT;
  143.         atomType:                LONGINT;                                { = 'stsc' }
  144.         flags:                    LONGINT;                                { 1 byte of version / 3 bytes of flags }
  145.         numEntries:                LONGINT;
  146.         sampleToChunkTable:        ARRAY [0..0] OF SampleToChunk;
  147.     END;
  148.  
  149.     ChunkOffsetAtom = RECORD
  150.         size:                    LONGINT;
  151.         atomType:                LONGINT;                                { = 'stco' }
  152.         flags:                    LONGINT;                                { 1 byte of version / 3 bytes of flags }
  153.         numEntries:                LONGINT;
  154.         chunkOffsetTable:        ARRAY [0..0] OF LONGINT;
  155.     END;
  156.  
  157.     SampleSizeAtom = RECORD
  158.         size:                    LONGINT;
  159.         atomType:                LONGINT;                                { = 'stsz' }
  160.         flags:                    LONGINT;                                { 1 byte of version / 3 bytes of flags }
  161.         sampleSize:                LONGINT;
  162.         numEntries:                LONGINT;
  163.         sampleSizeTable:        ARRAY [0..0] OF LONGINT;
  164.     END;
  165.  
  166.     ShadowSync = RECORD
  167.         fdSampleNum:            LONGINT;
  168.         syncSampleNum:            LONGINT;
  169.     END;
  170.  
  171.     ShadowSyncAtom = RECORD
  172.         size:                    LONGINT;
  173.         atomType:                LONGINT;                                { = 'stsz' }
  174.         flags:                    LONGINT;                                { 1 byte of version / 3 bytes of flags }
  175.         numEntries:                LONGINT;
  176.         shadowSyncTable:        ARRAY [0..0] OF ShadowSync;
  177.     END;
  178.  
  179.     SampleTableAtom = RECORD
  180.         size:                    LONGINT;
  181.         atomType:                LONGINT;                                { = 'stbl' }
  182.         sampleDescription:        SampleDescriptionAtom;
  183.         timeToSampleNum:        TimeToSampleNumAtom;
  184.         sampleToChunk:            SampleToChunkAtom;
  185.         syncSample:                SyncSampleAtom;
  186.         sampleSize:                SampleSizeAtom;
  187.         chunkOffset:            ChunkOffsetAtom;
  188.         shadowSync:                ShadowSyncAtom;
  189.     END;
  190.  
  191.     PublicHandlerInfo = RECORD
  192.         flags:                    LONGINT;                                { 1 byte of version / 3 bytes of flags }
  193.         componentType:            LONGINT;
  194.         componentSubType:        LONGINT;
  195.         componentManufacturer:    LONGINT;
  196.         componentFlags:            LONGINT;
  197.         componentFlagsMask:        LONGINT;
  198.         componentName:            PACKED ARRAY [0..0] OF CHAR;
  199.     END;
  200.  
  201.     HandlerAtom = RECORD
  202.         size:                    LONGINT;
  203.         atomType:                LONGINT;                                { = 'hdlr' }
  204.         hInfo:                    PublicHandlerInfo;
  205.     END;
  206.  
  207. { a data reference is a private structure }
  208.     DataRefAtom = LONGINT;
  209.  
  210.     DataInfoAtom = RECORD
  211.         size:                    LONGINT;
  212.         atomType:                LONGINT;                                { = 'dinf' }
  213.         dataRef:                DataRefAtom;
  214.     END;
  215.  
  216.     RgnAtom = RECORD
  217.         size:                    LONGINT;
  218.         atomType:                LONGINT;
  219.         rgnSize:                INTEGER;
  220.         rgnBBox:                Rect;
  221.         data:                    PACKED ARRAY [0..0] OF CHAR;
  222.     END;
  223.  
  224.     MatteCompressedAtom = RECORD
  225.         size:                    LONGINT;
  226.         atomType:                LONGINT;
  227.         flags:                    LONGINT;                                { 1 byte of version / 3 bytes of flags }
  228.         matteImageDescription:    ImageDescription;
  229.         matteData:                PACKED ARRAY [0..0] OF CHAR;
  230.     END;
  231.  
  232.     MatteAtom = RECORD
  233.         size:                    LONGINT;
  234.         atomType:                LONGINT;
  235.         aCompressedMatte:        MatteCompressedAtom;
  236.     END;
  237.  
  238.     ClippingAtom = RECORD
  239.         size:                    LONGINT;
  240.         atomType:                LONGINT;
  241.         aRgnClip:                RgnAtom;
  242.     END;
  243.  
  244. {**********************
  245. * Media Info Example Structures
  246. **********************}
  247.     VideoMediaInfoHeader = RECORD
  248.         flags:                    LONGINT;                                { 1 byte of version / 3 bytes of flags }
  249.         graphicsMode:            INTEGER;                                { for QD - transfer mode }
  250.         opColorRed:                INTEGER;                                { opcolor for transfer mode }
  251.         opColorGreen:            INTEGER;
  252.         opColorBlue:            INTEGER;
  253.     END;
  254.  
  255.     VideoMediaInfoHeaderAtom = RECORD
  256.         size:                    LONGINT;                                { size of Media info }
  257.         atomType:                LONGINT;                                { = 'vmhd' }
  258.         vmiHeader:                VideoMediaInfoHeader;
  259.     END;
  260.  
  261.     VideoMediaInfo = RECORD
  262.         size:                    LONGINT;                                { size of Media info }
  263.         atomType:                LONGINT;                                { = 'minf' }
  264.         header:                    VideoMediaInfoHeaderAtom;
  265.         dataHandler:            HandlerAtom;
  266.         dataInfo:                DataInfoAtom;
  267.         sampleTable:            SampleTableAtom;
  268.     END;
  269.  
  270.     SoundMediaInfoHeader = RECORD
  271.         flags:                    LONGINT;                                { 1 byte of version / 3 bytes of flags }
  272.         balance:                INTEGER;
  273.         rsrvd:                    INTEGER;
  274.     END;
  275.  
  276.     SoundMediaInfoHeaderAtom = RECORD
  277.         size:                    LONGINT;                                { size of Media info }
  278.         atomType:                LONGINT;                                { = 'vmhd' }
  279.         smiHeader:                SoundMediaInfoHeader;
  280.     END;
  281.  
  282.     SoundMediaInfo = RECORD
  283.         size:                    LONGINT;                                { size of Media info }
  284.         atomType:                LONGINT;                                { = 'minf' }
  285.         header:                    SoundMediaInfoHeaderAtom;
  286.         dataHandler:            HandlerAtom;
  287.         dataReference:            DataRefAtom;
  288.         sampleTable:            SampleTableAtom;
  289.     END;
  290.  
  291. { whatever data the media handler needs goes after the atomType }
  292.     MediaInfo = RECORD
  293.         size:                    LONGINT;
  294.         atomType:                LONGINT;
  295.     END;
  296.  
  297. {**********************
  298. * Media Directory Structures
  299. **********************}
  300.     MediaHeader = RECORD
  301.         flags:                    LONGINT;                                { 1 byte of version / 3 bytes of flags }
  302.         creationTime:            LONGINT;                                { seconds since Jan 1904 when directory was created }
  303.         modificationTime:        LONGINT;                                { seconds since Jan 1904 when directory was appended }
  304.         timeScale:                TimeValue;                                { start time for Media (Media time) }
  305.         duration:                TimeValue;                                { length of Media (Media time) }
  306.         language:                INTEGER;
  307.         quality:                INTEGER;
  308.     END;
  309.  
  310.     MediaHeaderAtom = RECORD
  311.         size:                    LONGINT;
  312.         atomType:                LONGINT;
  313.         header:                    MediaHeader;
  314.     END;
  315.  
  316.     MediaDirectory = RECORD
  317.         size:                    LONGINT;
  318.         atomType:                LONGINT;                                { = 'mdia' }
  319.         mediaHeader:            MediaHeaderAtom;                        { standard Media information }
  320.         mediaHandler:            HandlerAtom;
  321.         mediaInfo:                MediaInfo;
  322.     END;
  323.  
  324. {**********************
  325. * Track Structures
  326. **********************}
  327.  
  328. CONST
  329.     TrackEnable                    = 1 * (2**(0));
  330.     TrackInMovie                = 1 * (2**(1));
  331.     TrackInPreview                = 1 * (2**(2));
  332.     TrackInPoster                = 1 * (2**(3));
  333.  
  334.  
  335. TYPE
  336.     TrackHeader = RECORD
  337.         flags:                    LONGINT;                                { 1 byte of version / 3 bytes of flags }
  338.         creationTime:            LONGINT;                                { seconds since Jan 1904 when directory was created }
  339.         modificationTime:        LONGINT;                                { seconds since Jan 1904 when directory was appended }
  340.         trackID:                LONGINT;
  341.         reserved1:                LONGINT;
  342.         duration:                TimeValue;                                { length of track (track time) }
  343.         reserved2:                LONGINT;
  344.         reserved3:                LONGINT;
  345.         layer:                    INTEGER;
  346.         alternateGroup:            INTEGER;
  347.         volume:                    INTEGER;
  348.         reserved4:                INTEGER;
  349.         matrix:                    MatrixRecord;
  350.         trackWidth:                Fixed;
  351.         trackHeight:            Fixed;
  352.     END;
  353.  
  354.     TrackHeaderAtom = RECORD
  355.         size:                    LONGINT;                                { size of track header }
  356.         atomType:                LONGINT;                                { = 'tkhd' }
  357.         header:                    TrackHeader;
  358.     END;
  359.  
  360.     EditListType = RECORD
  361.         trackDuration:            TimeValue;
  362.         mediaTime:                TimeValue;
  363.         mediaRate:                Fixed;
  364.     END;
  365.  
  366.     EditListAtom = RECORD
  367.         size:                    LONGINT;
  368.         atomType:                LONGINT;                                { = elst }
  369.         flags:                    LONGINT;                                { 1 byte of version / 3 bytes of flags }
  370.         numEntries:                LONGINT;
  371.         editListTable:            ARRAY [0..0] OF EditListType;
  372.     END;
  373.  
  374.     EditsAtom = RECORD
  375.         size:                    LONGINT;
  376.         atomType:                LONGINT;                                { = edts }
  377.         editList:                EditListAtom;
  378.     END;
  379.  
  380.     TrackLoadSettings = RECORD
  381.         preloadStartTime:        TimeValue;
  382.         preloadDuration:        TimeValue;
  383.         preloadFlags:            LONGINT;
  384.         defaultHints:            LONGINT;
  385.     END;
  386.  
  387.     TrackLoadSettingsAtom = RECORD
  388.         size:                    LONGINT;
  389.         atomType:                LONGINT;                                { = load }
  390.         settings:                TrackLoadSettings;
  391.     END;
  392.  
  393.     TrackDirectory = RECORD
  394.         size:                    LONGINT;
  395.         atomType:                LONGINT;                                { = 'trak' }
  396.         trackHeader:            TrackHeaderAtom;                        { standard track information }
  397.         trackClip:                ClippingAtom;
  398.         edits:                    EditsAtom;
  399.         media:                    MediaDirectory;
  400.         userData:                UserDataAtom;                            { space for extending with new data types }
  401.     END;
  402.  
  403. {***************************************
  404. *
  405. *   MovieDirectory -
  406. *        The MovieDirectory is the top level structure which
  407. *        holds the TrackInstance describing where the
  408. *        TrackDirectories are.
  409. *
  410. ***************************************}
  411.     MovieHeader = RECORD
  412.         flags:                    LONGINT;                                { 1 byte of version / 3 bytes of flags }
  413.         creationTime:            LONGINT;                                { seconds since Jan 1904 when directory was created }
  414.         modificationTime:        LONGINT;                                { seconds since Jan 1904 when directory was appended }
  415.         timeScale:                TimeValue;                                { Time specifications }
  416.         duration:                TimeValue;
  417.         preferredRate:            Fixed;                                    { rate at which to play this movie }
  418.         preferredVolume:        INTEGER;                                { volume to play movie at }
  419.         reserved1:                INTEGER;
  420.         preferredLong1:            LONGINT;
  421.         preferredLong2:            LONGINT;
  422.         matrix:                    MatrixRecord;
  423.         previewTime:            TimeValue;                                { time in track the proxy begins (track time) }
  424.         previewDuration:        TimeValue;                                { how long the proxy lasts (track time) }
  425.         posterTime:                TimeValue;                                { time in track the proxy begins (track time) }
  426.         selectionTime:            TimeValue;                                { time in track the proxy begins (track time) }
  427.         selectionDuration:        TimeValue;                                { time in track the proxy begins (track time) }
  428.         currentTime:            TimeValue;                                { time in track the proxy begins (track time) }
  429.         nextTrackID:            LONGINT;                                { next value to use for a TrackID }
  430.     END;
  431.  
  432.     MovieHeaderAtom = RECORD
  433.         size:                    LONGINT;
  434.         atomType:                LONGINT;                                { = 'mvhd' }
  435.         header:                    MovieHeader;
  436.     END;
  437.  
  438.     MovieDirectory = RECORD
  439.         size:                    LONGINT;
  440.         atomType:                LONGINT;                                { = 'moov' }
  441.         header:                    MovieHeaderAtom;
  442.         movieClip:                ClippingAtom;
  443.         { Track Directories }
  444.         track:            RECORD
  445.                 trackDirectory:                    TrackDirectory;                    { Track directory information }
  446.             END;
  447.  
  448.  
  449.         { User data for Movie }
  450.         userData:                UserDataAtom;                            { space for user extensions }
  451.     END;
  452.  
  453.  
  454. CONST
  455. { some system defined format IDs }
  456.     MOVIE_TYPE                    = 'moov';
  457.     TRACK_TYPE                    = 'trak';
  458.     MEDIA_TYPE                    = 'mdia';
  459.     VIDEO_TYPE                    = 'vide';
  460.     SOUND_TYPE                    = 'soun';
  461.  
  462. { atom id's }
  463.     MovieAID                    = 'moov';
  464.     MovieHeaderAID                = 'mvhd';
  465.     ClipAID                        = 'clip';
  466.     RgnClipAID                    = 'crgn';
  467.     MatteAID                    = 'matt';
  468.     MatteCompAID                = 'kmat';
  469.     TrackAID                    = 'trak';
  470.     UserDataAID                    = 'udta';
  471.     TrackHeaderAID                = 'tkhd';
  472.     EditsAID                    = 'edts';
  473.     EditListAID                    = 'elst';
  474.     MediaAID                    = 'mdia';
  475.     MediaHeaderAID                = 'mdhd';
  476.     MediaInfoAID                = 'minf';
  477.     VideoMediaInfoHeaderAID        = 'vmhd';
  478.     SoundMediaInfoHeaderAID        = 'smhd';
  479.     GenericMediaInfoHeaderAID    = 'gmhd';
  480.     GenericMediaInfoAID            = 'gmin';
  481.     DataInfoAID                    = 'dinf';
  482.     DataRefAID                    = 'dref';
  483.     SampleTableAID                = 'stbl';
  484.     STSampleDescAID                = 'stsd';
  485.     STTimeToSampAID                = 'stts';
  486.     STSyncSampleAID                = 'stss';
  487.     STSampleToChunkAID            = 'stsc';
  488.     STShadowSyncAID                = 'stsh';
  489.     HandlerAID                    = 'hdlr';
  490.     STSampleSizeAID                = 'stsz';
  491.     STChunkOffsetAID            = 'stco';
  492.     DataRefContainerAID            = 'drfc';
  493.     TrackReferenceAID            = 'tref';
  494.     ColorTableAID                = 'ctab';
  495.     LoadSettingsAID                = 'load';
  496.  
  497.  
  498. {$ALIGN RESET}
  499. {$POP}
  500.  
  501. {$SETC UsingIncludes := MoviesFormatIncludes}
  502.  
  503. {$ENDC} {__MOVIESFORMAT__}
  504.  
  505. {$IFC NOT UsingIncludes}
  506.  END.
  507. {$ENDC}
  508.